import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;


public class GUIprogressbar extends JFrame implements ActionListener{

	private JPanel panel = new JPanel();
	private JButton button = new JButton("click");
	private JButton button2 = new JButton("start");
	private JLabel label = new JLabel("test");
	private LinkedList<JProgressBar> pBar = new LinkedList<JProgressBar>();
	private int count;
	private int num = 1;
	
	public GUIprogressbar(){
		
		button.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				if(button == e.getSource()){
					pBar.add(new JProgressBar(0,100));
					pBar.get(count).setStringPainted(true);

				}
			}
		});
		button2.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			
		});	
			
		
		this.initWindow();
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
	
		
	}
	
	private void initWindow(){
		
		this.setTitle("test progressbar");
		this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
		panel.setLayout(new GridLayout(0,1,10,10));
		panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
		panel.add(button);
	//	panel.add(pBar.get(count));
		panel.add(label);
		this.add(panel);
		this.pack();
		this.setVisible(true);
	}
	

}
